package com.itheima.d_request_04;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/RequestServlet03")
//http://localhost:8080/day07/RequestServlet03?username=zhangsan&password=123
public class RequestServlet03 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        System.out.println(request.getMethod());

        System.out.println(request.getContextPath());

        StringBuffer requestURL = request.getRequestURL();
        System.out.println(requestURL.toString());

        System.out.println(request.getRequestURI());

        System.out.println(request.getQueryString());

        System.out.println(request.getParameter("username"));

        System.out.println(request.getParameter("password"));

    }
}